<div>
    <div class="row">
        <div class="col-md-4 col-md-offset-4">
            <h1>Reset password</h1>

            <div class="alert alert-danger" *ngIf="keyMissing">
                <strong>The password reset key is missing.</strong>
            </div>

            <div class="alert alert-warning" *ngIf="!success && !keyMissing">
                <p>Choose a new password</p>
            </div>

            <div class="alert alert-danger" *ngIf="error">
                <p>Your password couldn't be reset. Remember a password request is only valid for 24 hours.</p>
            </div>

            <p class="alert alert-success" *ngIf="success">
                <span><strong>Your password has been reset.</strong> Please </span>
                <a class="alert-link" (click)="login()">sign in</a>.
            </p>

            <div class="alert alert-danger" *ngIf="doNotMatch">
                The password and its confirmation do not match!
            </div>

            <div *ngIf="!keyMissing">
                <form *ngIf="!success" name="form" role="form" (ngSubmit)="finishReset()" #passwordForm="ngForm">
                    <div class="form-group">
                        <label class="form-control-label" for="password">New password</label>
                        <input type="password" class="form-control" id="password" name="password" #passwordInput="ngModel"
                               placeholder="New password"
                               [(ngModel)]="resetAccount.password" minlength=4 maxlength=50 required>
                        <div *ngIf="passwordInput.dirty && passwordInput.invalid">
                            <small class="form-text text-danger"
                               *ngIf="passwordInput.errors.required">
                                Your password is required.
                            </small>
                            <small class="form-text text-danger"
                               *ngIf="passwordInput.errors.minlength">
                                Your password is required to be at least 4 characters.
                            </small>
                            <small class="form-text text-danger"
                               *ngIf="passwordInput.errors.maxlength">
                                Your password cannot be longer than 50 characters.
                            </small>
                        </div>
                        <jhi-password-strength-bar [passwordToCheck]="resetAccount.password"></jhi-password-strength-bar>
                    </div>

                    <div class="form-group">
                        <label class="form-control-label" for="confirmPassword">New password confirmation</label>
                        <input type="password" class="form-control" id="confirmPassword" name="confirmPassword" #confirmPasswordInput="ngModel"
                               placeholder="Confirm the new password"
                               [(ngModel)]="confirmPassword" minlength=4 maxlength=50 required>
                        <div *ngIf="confirmPasswordInput.dirty && confirmPasswordInput.invalid">
                            <small class="form-text text-danger"
                               *ngIf="confirmPasswordInput.errors.required">
                                Your password confirmation is required.
                            </small>
                            <small class="form-text text-danger"
                               *ngIf="confirmPasswordInput.errors.minlength">
                                Your password confirmation is required to be at least 4 characters.
                            </small>
                            <small class="form-text text-danger"
                               *ngIf="confirmPasswordInput.errors.maxlength">
                                Your password confirmation cannot be longer than 50 characters.
                            </small>
                        </div>
                    </div>
                    <button type="submit" [disabled]="passwordForm.form.invalid" class="btn btn-primary">Reset Password</button>
                </form>
            </div>

        </div>
    </div>
</div>
